<template>
<div>
    <Card style="border-top:4px solid orange;margin-top:20px;">
        <p slot="title"font-size="60px" style="text-indent:2em;text-align:center">{{service_detail.title}}</p></br>        
            <h2 >内容详情：</h2>
            &nbsp&nbsp&nbsp&nbsp&nbsp{{service_detail.content}}
        </br>
            <h2>申请流程：</h2>
            <Card>
                <StepsEditor mode="preview_default" :source="service_detail" source-type="service"></StepsEditor>
            </Card>
        
        <Row>
            <Col span="24" style="text-align:center;margin-top:1em;">
                <Button type="primary" @click="getService">申请服务</Button>
            </Col>
        </Row>
    </Card>
    <Modal v-model="modal1" title="消息提示" @on-ok="login" @on-cancel="cancel">
        <b><font size="3">您处于未登录状态，点击前往登陆页面</font></b>        
    </Modal>
</div>    
</template>

<script>
import util from "../../libs/util";
import Cookies from 'js-cookie';
import PlateformService from "@/common/model/PlateformService";
import StepsEditor from "@/common/components/StepsEditor";

export default {
    components: {
        StepsEditor
    },
    data(){
        return {
            modal1: false,
            is_landing: Cookies.get('access') == "member",
            service_detail: new PlateformService()
        }
    },
    methods:{
         cancel(){

        },
        login(){
            
            this.$router.push({name:"login"});
            //window.location.href=util.getRuntimeUrl('index', 'login');
        },
        getService(){
            if(this.is_landing){
                this.api.post("plateformabutment/post",{plateformservice_id:this.$route.params.id},res=>{
                    if(res.value==true){
                        window.location.href = util.getRuntimeUrl('member', 'plateformservice/applied_plateformservice');
                    }else{
                        this.$CustomMessage.error(res.message);
                    }
                });
            }else {
                this.modal1 = true;
            }
        }
    },
    created(){
    //    this.is_landing = Cookies.get('access') == "member";
    //     console.log(this.is_landing);
        this.api.post("plateformservice/get",{id:this.$route.params.id},res=>{
            //this.service_detail = res.data;
           this.service_detail.parse(res.data);
        });
    }
}
</script>
<style>
.text-overflow {
display:block;/*内联对象需加*/
width:50em;
word-break:keep-all;/* 不换行 */
white-space:nowrap;/* 不换行 */
overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */
text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...) ；需与overflow:hidden;一起使用。*/
}
</style>